﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;

namespace 第十一次作业
{
    public partial class Form1 : Form
    {
        SQLiteConnection con;
        SQLiteCommand cmd;

        public Form1()
        {
            InitializeComponent();
            //连接数据库
            string connectionString = "data source=data.sqlite";
            con = new SQLiteConnection(connectionString);
            con.Open();
            cmd = new SQLiteCommand(con);
        }

        private void button1_Click(object sender, EventArgs e)
        {

            cmd.CommandText = "select English from E_C where Chinese = '放弃'";
            var English = cmd.ExecuteScalar();
            if (textBox1.Text.Equals(English))
            {
                MessageBox.Show("正确");
            }
            else
            {
                MessageBox.Show("不正确");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            cmd.CommandText = "select English from E_C where Chinese = '苹果'";
            var English = cmd.ExecuteScalar();
            if (textBox2.Text.Equals(English))
            {
                MessageBox.Show("正确");
            }
            else
            {
                MessageBox.Show("不正确");
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            cmd.CommandText = "select English from E_C where Chinese = '橙'";
            var English = cmd.ExecuteScalar();
            if (textBox3.Text.Equals(English))
            {
                MessageBox.Show("正确");
            }
            else
            {
                MessageBox.Show("不正确");
            }
        }
    }

}
